package UnitTest.DataStructureTest.stringANDlineTest.slidingWindowTest;

import DataStructure.stringANDline.slidingWindow.ArrayPermutation_Sliding;
import TestData.DataStructureTestData.stringANDlineTestData.slidingWindowTestData.SlidingWindowTestData;
import UnitTest.AlgorithmTest.backtrackTest.ArrayPermutationTest;
import org.junit.Test;

import java.util.List;

public class ArrayPermutation_SlidingTest extends SlidingWindowTestData {

    ArrayPermutation_Sliding arrayPermutationTwoPoint = new ArrayPermutation_Sliding();

    @Test
    public void test() {

        List<List<Integer>> list_all = arrayPermutationTwoPoint.getAnswer(demo01, target01);

        assert list_all.size() == answer01.length;
        for (int i = 0; i < answer01.length; i++) {
            List list = list_all.get(i);
            int[] answer01_sub = answer01[i];

            for (int j = 0; j < list.size(); j++) {
                assert answer01_sub[j] == (int) list.get(j);
            }
        }

        list_all = arrayPermutationTwoPoint.getAnswer(demo02, target02);
        assert list_all.size() == answer02.length;
        for (int i = 0; i < list_all.size(); i++) {
            List list = list_all.get(i);
            int[] answer01_sub = answer02[i];
            for (int j = 0; j < list.size(); j++) {
                assert answer01_sub[j] == (int) list.get(j);
            }
        }

        list_all = arrayPermutationTwoPoint.getAnswer(demo03, target03);
        assert list_all.size() == answer03.length;
        for (int i = 0; i < list_all.size(); i++) {
            List list = list_all.get(i);
            int[] answer01_sub = answer03[i];
            for (int j = 0; j < list.size(); j++) {
                assert answer01_sub[j] == (int) list.get(j);
            }
        }
    }
}
